﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type Menu}"
         
           >
        <Style.Resources>
            <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}"
                   TargetType="Separator">
                <Setter Property="Height"
                        Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Separator">
                            <Border Background="{DynamicResource SeparatorBackground}"
                                    Height="1"
                                    Margin="10,0,10,0" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="{x:Type MenuItem}">
                <Setter Property="Foreground"
                        Value="{DynamicResource WindowText}" />
                <Setter Property="Padding" 
                        Value="10"/>
                <Setter Property="MinHeight" 
                        Value="50"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <!--Border 1-->
                            <Border x:Name="Border"
                                    Background="Transparent"
                                    BorderBrush="Transparent"
                                    BorderThickness="1"
                                    SnapsToDevicePixels="False">
                                <Grid x:Name="Grid">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition x:Name="Col0"
                                                          MinWidth="8"
                                                          Width="Auto"
                                                          SharedSizeGroup="MenuItemIconColumnGroup" />
                                        <ColumnDefinition Width="Auto"
                                                          SharedSizeGroup="MenuTextColumnGroup" />
                                        <ColumnDefinition Width="Auto"
                                                          SharedSizeGroup="MenuItemIGTColumnGroup" />
                                        <ColumnDefinition x:Name="Col3"
                                                          Width="14" />
                                    </Grid.ColumnDefinitions>
                                    <ContentPresenter Grid.Column="0"
                                                      x:Name="Icon"
                                                      VerticalAlignment="Center"
                                                      ContentSource="Icon" />
                                    <ContentPresenter Grid.Column="1"
                                                      Margin="{TemplateBinding Padding}"
                                                      x:Name="HeaderHost"
                                                      RecognizesAccessKey="True"
                                                      ContentSource="Header"
                                                      TextElement.Foreground="{TemplateBinding Foreground}"
                                                      VerticalAlignment="Center" />
                                    <ContentPresenter Grid.Column="2"
                                                      Margin="8,1,8,1"
                                                      x:Name="IGTHost"
                                                      ContentSource="InputGestureText"
                                                      VerticalAlignment="Center" />
                                    <Grid Grid.Column="3"
                                          Margin="4,0,6,0"
                                          x:Name="ArrowPanel"
                                          VerticalAlignment="Center">
                                        <Path x:Name="ArrowPanelPath"
                                              HorizontalAlignment="Right"
                                              VerticalAlignment="Center"
                                              Fill="{TemplateBinding Foreground}"
                                              Data="M0,0 L0,8 L4,4 z" />
                                    </Grid>
                                    <Popup IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                                           Placement="Right"
                                           HorizontalOffset="0"
                                           x:Name="SubMenuPopup"
                                           Focusable="false"
                                           PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                                           AllowsTransparency="True">
                                        <Grid Margin="0,0,5,5">
                                            <!--Border 2-->
                                            <Border x:Name="SubMenuBorder"
                                                    BorderBrush="{DynamicResource Accent}"
                                                    BorderThickness="1"
                                                    Background="{DynamicResource WindowBackground}"
                                                    SnapsToDevicePixels="True">
                                                <Grid x:Name="SubMenu"
                                                      Grid.IsSharedSizeScope="True"
                                                      Margin="2">
                                                    <StackPanel IsItemsHost="True"
                                                                KeyboardNavigation.DirectionalNavigation="Cycle" />
                                                </Grid>
                                            </Border>
                                            <!--Border 3-->
                                            <Border Margin="1,0,0,0"
                                                    x:Name="TransitionBorder"
                                                    Width="0"
                                                    Height="2"
                                                    VerticalAlignment="Top"
                                                    HorizontalAlignment="Left"
                                                    Background="{DynamicResource WindowBackground}"
                                                    SnapsToDevicePixels="False"
                                                    BorderThickness="1"
                                                    BorderBrush="{DynamicResource Accent}" />
                                        </Grid>
                                    </Popup>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Role"
                                         Value="TopLevelHeader">

                                    <Setter Property="Padding"
                                            Value="6,0,6,2" />
                                    <Setter TargetName="SubMenuPopup"
                                            Property="Placement"
                                            Value="Bottom" />
                                    <Setter TargetName="Col0"
                                            Property="MinWidth"
                                            Value="0" />
                                    <Setter TargetName="Col3"
                                            Property="Width"
                                            Value="Auto" />
                                    <Setter TargetName="Icon"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="IGTHost"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="ArrowPanel"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="SubMenuBorder"
                                            Property="BorderThickness"
                                            Value="1" />
                                    <Setter TargetName="SubMenu"
                                            Property="Margin"
                                            Value="2,3,2,2" />
                                    <Setter TargetName="TransitionBorder"
                                            Property="Width"
                                            Value="{Binding ActualWidth, ElementName=Grid}" />
                                </Trigger>
                                <Trigger Property="Role"
                                         Value="TopLevelItem">
                                    
                                    <Setter Property="Padding"
                                            Value="6,0,6,2" />
                                    <Setter TargetName="Col0"
                                            Property="MinWidth"
                                            Value="0" />
                                    <Setter TargetName="Col3"
                                            Property="Width"
                                            Value="Auto" />
                                    <Setter TargetName="Icon"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="IGTHost"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="ArrowPanel"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                </Trigger>
                                <Trigger Property="Role"
                                         Value="SubmenuHeader">
                                    <Setter Property="DockPanel.Dock"
                                            Value="Top" />
                                    <Setter Property="Padding"
                                            Value="10,3,0,3" />
                                    <Setter TargetName="Border"
                                            Property="MinHeight"
                                            Value="22" />
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{DynamicResource WindowBackground}" />
                                    <Setter Property="Foreground" Value="{DynamicResource WindowText}"/>
                                </Trigger>
                                <Trigger Property="Role"
                                         Value="SubmenuItem">
                                    <Setter Property="DockPanel.Dock"
                                            Value="Top" />
                                    <Setter Property="Padding"
                                            Value="10,3,0,3" />
                                    <Setter TargetName="Border"
                                            Property="MinHeight"
                                            Value="22" />
                                    <Setter TargetName="ArrowPanel"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{DynamicResource WindowBackground}" />
                                    <Setter Property="Foreground" Value="{DynamicResource WindowText}"/>
                                </Trigger>

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsHighlighted"
                                                   Value="true" />
                                        <Condition Property="Role"
                                                   Value="TopLevelHeader" />
                                    </MultiTrigger.Conditions>
                                    
                                    <Setter TargetName="Border"
                                            Property="BorderBrush"
                                            Value="{DynamicResource Accent}" />
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="Red" />
                                </MultiTrigger>

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsHighlighted"
                                                   Value="true" />
                                        <Condition Property="Role"
                                                   Value="TopLevelItem" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{DynamicResource Accent}" />
                                    <Setter TargetName="Border"
                                            Property="BorderBrush"
                                            Value="LightGray" />
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsHighlighted"
                                                   Value="true" />
                                        <Condition Property="Role"
                                                   Value="SubmenuHeader" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{DynamicResource Accent}" />
                                    <Setter TargetName="Border"
                                            Property="BorderBrush"
                                            Value="LightGray" />
                                    
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsHighlighted"
                                                   Value="true" />
                                        <Condition Property="Role"
                                                   Value="SubmenuItem" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{DynamicResource Accent}" />
                                    <Setter TargetName="Border"
                                            Property="BorderBrush"
                                            Value="LightGray" />
                                </MultiTrigger>
                                
                                <Trigger Property="IsSubmenuOpen"
                                         Value="true">
                                    <Setter TargetName="ArrowPanelPath"
                                            Property="Fill"
                                            Value="WhiteSmoke" />
                                </Trigger>
                                <Trigger Property="IsSuspendingPopupAnimation"
                                         Value="true">
                                    <Setter TargetName="SubMenuPopup"
                                            Property="PopupAnimation"
                                            Value="None" />
                                </Trigger>
                                <Trigger Property="Icon"
                                         Value="{x:Null}">
                                    <Setter TargetName="Icon"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                </Trigger>
                                <Trigger Property="IsEnabled"
                                         Value="False">
                                    <Setter Property="Foreground"
                                            Value="{DynamicResource InputTextDisabled}" />
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="Border" Property="Background" Value="{DynamicResource TitleBackgroundBrush}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
        <Setter Property="Background"
                Value="{DynamicResource WindowBackground}" />
        
        <Setter Property="Foreground"
                Value="{DynamicResource WindowText}" />
    </Style>

</ResourceDictionary>